﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using System.Data.Common;
namespace Demo.Repository
{
    interface IDemoDAL<T> : IDisposable where T : class
    {
        ICollection<T> GetAll(Expression<Func<T, bool>> match, string[] includes = null);

        ICollection<T> CallProcedure(string procName, SqlParameter[] parameter);

        DbDataReader CallProcedure(string procName, SqlParameter[] parameter, string nothing);

        ICollection<T> GetAll(string[] include = null);

        Task<ICollection<T>> GetAllAsync();

        T Get(int id);

        Task<T> GetAsync(int id);

        T Find(Expression<Func<T, bool>> match);

        Task<T> FindAsync(Expression<Func<T, bool>> match);

        ICollection<T> FindAll(Expression<Func<T, bool>> match);

        Task<ICollection<T>> FindAllAsync(Expression<Func<T, bool>> match);

        T Add(T t, bool valid = true);

        Task<T> AddAsync(T t);

        T Update(T updated, int key);

        T Update(T updated);

        Task<T> UpdateAsync(T updated, int key);

        void Delete(T t);

        Task<int> DeleteAsync(T t);

        int Count();

        Task<int> CountAsync();

        List<T> MapToList<T>(DbDataReader dr) where T : new();
    }
}
